//////////////////////////////////////////ok
#include"stdafx.h"
#include "bochs.h"


bx_bool IA32_CPU::get_CFLazy(void)
{

  unsigned cf;
  switch (  lf_flags_status & 0x00000f ) 
  {
    case IA32_LF_INDEX_OSZAPC:
      switch ( oszapc.instr) 
	  {
        case IA32_INSTR_ADD8:
          cf = ( oszapc.result_8 < oszapc.op1_8);
          break;
        case IA32_INSTR_ADD16:
          cf = ( oszapc.result_16 < oszapc.op1_16);
          break;
        case IA32_INSTR_ADD32:
          cf = ( oszapc.result_32 < oszapc.op1_32);
          break;
        case IA32_INSTR_ADC8:
          cf = ( oszapc.result_8 <= oszapc.op1_8);
          break;
        case IA32_INSTR_ADC16:
          cf = ( oszapc.result_16 <= oszapc.op1_16);
          break;
        case IA32_INSTR_ADC32:
          cf = ( oszapc.result_32 <= oszapc.op1_32);
          break;
        case IA32_INSTR_SUB8:
          cf = ( oszapc.op1_8 <  oszapc.op2_8);
          break;
        case IA32_INSTR_SUB16:
          cf = ( oszapc.op1_16 < oszapc.op2_16);
          break;
        case IA32_INSTR_SUB32:
          cf = ( oszapc.op1_32 < oszapc.op2_32);
          break;
        case IA32_INSTR_SBB8:
          cf = ( oszapc.op1_8 <  oszapc.result_8) || ( oszapc.op2_8==0xff);
          break;
        case IA32_INSTR_SBB16:
          cf = ( oszapc.op1_16 <  oszapc.result_16) || ( oszapc.op2_16==0xffff);
          break;
        case IA32_INSTR_SBB32:
          cf = ( oszapc.op1_32 <  oszapc.result_32) || ( oszapc.op2_32==0xffffffff);
          break;
        case IA32_INSTR_NEG8:
          cf =  oszapc.result_8 != 0;
          break;
        case IA32_INSTR_NEG16:
          cf =  oszapc.result_16 != 0;
          break;
        case IA32_INSTR_NEG32:
          cf =  oszapc.result_32 != 0;
          break;
        case IA32_INSTR_LOGIC8:
        case IA32_INSTR_LOGIC16:
        case IA32_INSTR_LOGIC32:
        case IA32_INSTR_BITSCAN16:
        case IA32_INSTR_BITSCAN32:
          cf = 0;
          break;
        case IA32_INSTR_SAR8:
		  if ( oszapc.op2_8 < 8) 
		  {
			cf = ( oszapc.op1_8 >> ( oszapc.op2_8 - 1)) & 0x01;
		  }
		  else 
		  {
			cf = ( oszapc.op1_8 & 0x80) > 0;
		  }
          break;
        case IA32_INSTR_SHR8:
          cf = ( oszapc.op1_8 >> ( oszapc.op2_8 - 1)) & 0x01;
          break;
        case IA32_INSTR_SAR16:
		  if ( oszapc.op2_16 < 16) 
		  {
			cf = ( oszapc.op1_16 >> ( oszapc.op2_16 - 1)) & 0x01;
		  }
		  else 
		  {
			cf = ( oszapc.op1_16 & 0x8000) > 0;
		  }
          break;
        case IA32_INSTR_SHR16:
          cf = ( oszapc.op1_16 >> ( oszapc.op2_16 - 1)) & 0x01;
          break;
        case IA32_INSTR_SAR32:
        case IA32_INSTR_SHR32:
          cf = ( oszapc.op1_32 >> ( oszapc.op2_32 - 1)) & 0x01;
          break;
        case IA32_INSTR_SHL8:
          if ( oszapc.op2_8 <= 8) 
		  {
            cf = ( oszapc.op1_8 >> (8 -  oszapc.op2_8)) & 0x01;
          }
          else 
		  {
            cf = 0;
          }
          break;
        case IA32_INSTR_SHL16:
		  if(oszapc.op2_16 <= 16) 
		  {
			 cf = (oszapc.op1_16 >> (16 - oszapc.op2_16)) & 0x01;
		  }
		  else 
		  {
			 cf = 0;
		  }
          break;
        case IA32_INSTR_SHL32:
          cf = ( oszapc.op1_32 >> (32 -  oszapc.op2_32)) & 0x01;
          break;
        case IA32_INSTR_IMUL8:
          cf = ! (( oszapc.op1_8 < 0x80 && oszapc.op2_8 == 0) || (( oszapc.op1_8 & 0x80) && oszapc.op2_8 == 0xff));
          break;
        case IA32_INSTR_IMUL16:
          cf = ! (( oszapc.op1_16 < 0x8000 && oszapc.op2_16 == 0) || (( oszapc.op1_16 & 0x8000) && oszapc.op2_16 == 0xffff));
          break;
        case IA32_INSTR_IMUL32:
          cf = ! (( oszapc.op1_32 < 0x80000000 && oszapc.op2_32 == 0) || (( oszapc.op1_32 & 0x80000000) && oszapc.op2_32 == 0xffffffff));
          break;
        case IA32_INSTR_MUL8:
          cf = ( oszapc.op2_8 != 0);
          break;
        case IA32_INSTR_MUL16:
          cf = ( oszapc.op2_16 != 0);
          break;
        case IA32_INSTR_MUL32:
          cf = ( oszapc.op2_32 != 0);
          break;
        default:
          cf = 0; 
        }
       lf_flags_status &= 0xfffff0;
       eflags.val32 &= ~(1<<0);
       eflags.val32 |= (!!cf)<<0;
      return(cf);
    default:
      return(0);
    }

}

bx_bool IA32_CPU::get_AFLazy(void)
{
  unsigned af;

  switch ( ( lf_flags_status>>8) & 0x00000f ) 
  {
    case IA32_LF_INDEX_OSZAPC:
      switch ( oszapc.instr) 
	  {
        case IA32_INSTR_ADD8:
        case IA32_INSTR_ADC8:
        case IA32_INSTR_SUB8:
        case IA32_INSTR_SBB8:
          af =
            (( oszapc.op1_8 ^
               oszapc.op2_8) ^
              oszapc.result_8) & 0x10;
          break;
        case IA32_INSTR_ADD16:
        case IA32_INSTR_ADC16:
        case IA32_INSTR_SUB16:
        case IA32_INSTR_SBB16:
          af =
            (( oszapc.op1_16 ^
               oszapc.op2_16) ^
              oszapc.result_16) & 0x10;
          break;
        case IA32_INSTR_ADD32:
        case IA32_INSTR_ADC32:
        case IA32_INSTR_SUB32:
        case IA32_INSTR_SBB32:
          af =
            (( oszapc.op1_32 ^
               oszapc.op2_32) ^
              oszapc.result_32) & 0x10;
          break;
        case IA32_INSTR_NEG8:
          af = ( oszapc.result_8 & 0x0f) != 0;
          break;
        case IA32_INSTR_NEG16:
          af = ( oszapc.result_16 & 0x0f) != 0;
          break;
        case IA32_INSTR_NEG32:
          af = ( oszapc.result_32 & 0x0f) != 0;
          break;
        case IA32_INSTR_LOGIC8:
        case IA32_INSTR_LOGIC16:
        case IA32_INSTR_LOGIC32:
        case IA32_INSTR_BITSCAN16:
        case IA32_INSTR_BITSCAN32:
        case IA32_INSTR_SAR8:
        case IA32_INSTR_SAR16:
        case IA32_INSTR_SAR32:
        case IA32_INSTR_SHR8:
        case IA32_INSTR_SHR16:
        case IA32_INSTR_SHR32:
        case IA32_INSTR_SHL8:
        case IA32_INSTR_SHL16:
        case IA32_INSTR_SHL32:
        case IA32_INSTR_IMUL8:
        case IA32_INSTR_IMUL16:
        case IA32_INSTR_IMUL32:
        case IA32_INSTR_MUL8:
        case IA32_INSTR_MUL16:
        case IA32_INSTR_MUL32:
          af = 0;
          break;
        default:
          af = 0; // Keep compiler quiet.
        }
       lf_flags_status &= 0xfff0ff;
       eflags.val32 &= ~(1<<4);
       eflags.val32 |= (!!af)<<4;
      return(af);
    case IA32_LF_INDEX_OSZAP:
      switch ( oszap.instr) 
	  {
        case IA32_INSTR_INC8:
          af = ( oszap.result_8 & 0x0f) == 0;
          break;
        case IA32_INSTR_INC16:
          af = ( oszap.result_16 & 0x0f) == 0;
          break;
        case IA32_INSTR_INC32:
          af = ( oszap.result_32 & 0x0f) == 0;
          break;
        case IA32_INSTR_DEC8:
          af = ( oszap.result_8 & 0x0f) == 0x0f;
          break;
        case IA32_INSTR_DEC16:
          af = ( oszap.result_16 & 0x0f) == 0x0f;
          break;
        case IA32_INSTR_DEC32:
          af = ( oszap.result_32 & 0x0f) == 0x0f;
          break;
        default:
          af = 0; // Keep compiler quiet.
        }
       lf_flags_status &= 0xfff0ff;
       eflags.val32 &= ~(1<<4);
       eflags.val32 |= (!!af)<<4;
      return(af);
    default:
      return(0);
    }
}

bx_bool IA32_CPU::get_ZFLazy(void)
{
  unsigned zf;

  switch ( ( lf_flags_status>>12) & 0x00000f ) 
  {
    case IA32_LF_INDEX_OSZAPC:
      switch ( oszapc.instr) 
	  {
        case IA32_INSTR_LOGIC8:
        case IA32_INSTR_ADD8:
        case IA32_INSTR_ADC8:
        case IA32_INSTR_SUB8:
        case IA32_INSTR_SBB8:
        case IA32_INSTR_NEG8:
        case IA32_INSTR_SAR8:
        case IA32_INSTR_SHR8:
        case IA32_INSTR_SHL8:
          zf = ( oszapc.result_8 == 0);
          break;
        case IA32_INSTR_LOGIC16:
        case IA32_INSTR_ADD16:
        case IA32_INSTR_ADC16:
        case IA32_INSTR_SUB16:
        case IA32_INSTR_SBB16:
        case IA32_INSTR_NEG16:
        case IA32_INSTR_SAR16:
        case IA32_INSTR_SHR16:
        case IA32_INSTR_SHL16:
          zf = ( oszapc.result_16 == 0);
          break;
        case IA32_INSTR_LOGIC32:
        case IA32_INSTR_ADD32:
        case IA32_INSTR_ADC32:
        case IA32_INSTR_SUB32:
        case IA32_INSTR_SBB32:
        case IA32_INSTR_NEG32:
        case IA32_INSTR_SAR32:
        case IA32_INSTR_SHR32:
        case IA32_INSTR_SHL32:
          zf = ( oszapc.result_32 == 0);
          break;
        case IA32_INSTR_IMUL8:
        case IA32_INSTR_MUL8:
          zf = ( oszapc.op1_8 == 0);
          break;
        case IA32_INSTR_IMUL16:
        case IA32_INSTR_MUL16:
          zf = ( oszapc.op1_16 == 0);
          break;
        case IA32_INSTR_IMUL32:
        case IA32_INSTR_MUL32:
          zf = ( oszapc.op1_32 == 0);
          break;
        case IA32_INSTR_BITSCAN16:
        case IA32_INSTR_BITSCAN32:
          zf = 0;
          break;
        default:
          zf = 0;
        }
       lf_flags_status &= 0xff0fff;
       eflags.val32 &= ~(1<<6);
       eflags.val32 |= zf<<6; // zf always exactly 0 or 1.
      return(zf);
    case IA32_LF_INDEX_OSZAP:
      switch ( oszap.instr) 
	  {
        case IA32_INSTR_INC8:
        case IA32_INSTR_DEC8:
          zf = ( oszap.result_8 == 0);
          break;
        case IA32_INSTR_INC16:
        case IA32_INSTR_DEC16:
          zf = ( oszap.result_16 == 0);
          break;
        case IA32_INSTR_INC32:
        case IA32_INSTR_DEC32:
          zf = ( oszap.result_32 == 0);
          break;
        default:
          zf = 0;
        }
       lf_flags_status &= 0xff0fff;
       eflags.val32 &= ~(1<<6);
       eflags.val32 |= zf<<6; // zf always exactly 0 or 1.
      return(zf);
    default:
      return(0);
    }

}

bx_bool IA32_CPU::get_SFLazy(void)
{
  unsigned sf;

  switch ( ( lf_flags_status>>16) & 0x00000f ) 
  {
    case IA32_LF_INDEX_OSZAPC:
      switch ( oszapc.instr) 
	  {
        case IA32_INSTR_LOGIC8:
        case IA32_INSTR_ADD8:
        case IA32_INSTR_ADC8:
        case IA32_INSTR_SUB8:
        case IA32_INSTR_SBB8:
        case IA32_INSTR_NEG8:
        case IA32_INSTR_SAR8:
        case IA32_INSTR_SHR8:
        case IA32_INSTR_SHL8:
          sf = ( oszapc.result_8 >= 0x80);
          break;
        case IA32_INSTR_LOGIC16:
        case IA32_INSTR_ADD16:
        case IA32_INSTR_ADC16:
        case IA32_INSTR_SUB16:
        case IA32_INSTR_SBB16:
        case IA32_INSTR_NEG16:
        case IA32_INSTR_SAR16:
        case IA32_INSTR_SHR16:
        case IA32_INSTR_SHL16:
        case IA32_INSTR_BITSCAN16:
          sf = ( oszapc.result_16 >= 0x8000);
          break;
        case IA32_INSTR_LOGIC32:
        case IA32_INSTR_ADD32:
        case IA32_INSTR_ADC32:
        case IA32_INSTR_SUB32:
        case IA32_INSTR_SBB32:
        case IA32_INSTR_NEG32:
        case IA32_INSTR_SAR32:
        case IA32_INSTR_SHR32:
        case IA32_INSTR_SHL32:
        case IA32_INSTR_BITSCAN32:
          sf = ( oszapc.result_32 >= 0x80000000);
          break;
        case IA32_INSTR_IMUL8:
        case IA32_INSTR_MUL8:
          sf = ( oszapc.op1_8 >= 0x80);
          break;
        case IA32_INSTR_IMUL16:
        case IA32_INSTR_MUL16:
          sf = ( oszapc.op1_16 >= 0x8000);
          break;
        case IA32_INSTR_IMUL32:
        case IA32_INSTR_MUL32:
          sf = ( oszapc.op1_32 >= 0x80000000);
          break;
        default:
          sf = 0; // Keep compiler quiet.
        }
       lf_flags_status &= 0xf0ffff;
       eflags.val32 &= ~(1<<7);
       eflags.val32 |= (!!sf)<<7;
      return(sf);
    case IA32_LF_INDEX_OSZAP:
      switch ( oszap.instr) 
	  {
        case IA32_INSTR_INC8:
        case IA32_INSTR_DEC8:
          sf = ( oszap.result_8 >= 0x80);
          break;
        case IA32_INSTR_INC16:
        case IA32_INSTR_DEC16:
          sf = ( oszap.result_16 >= 0x8000);
          break;
        case IA32_INSTR_INC32:
        case IA32_INSTR_DEC32:
          sf = ( oszap.result_32 >= 0x80000000);
          break;
        default:
          sf = 0; // Keep compiler quiet.
        }
       lf_flags_status &= 0xf0ffff;
       eflags.val32 &= ~(1<<7);
       eflags.val32 |= (!!sf)<<7;
      return(sf);
    default:
      return(0);
    }

}

bx_bool IA32_CPU::get_OFLazy(void)
{
  Bit8u op1_b7, op2_b7, result_b7;
  Bit16u op1_b15, op2_b15, result_b15;
  Bit32u op1_b31, op2_b31, result_b31;
  unsigned of;

  switch ( ( lf_flags_status>>20) & 0x00000f ) 
  {
    case IA32_LF_INDEX_OSZAPC:
      switch ( oszapc.instr) 
	  {
        case IA32_INSTR_ADD8:
        case IA32_INSTR_ADC8:
          op1_b7 =  oszapc.op1_8 & 0x80;
          op2_b7 =  oszapc.op2_8 & 0x80;
          result_b7 =  oszapc.result_8 & 0x80;
          of = (op1_b7 == op2_b7) && (result_b7 ^ op2_b7);
          break;
        case IA32_INSTR_ADD16:
        case IA32_INSTR_ADC16:
          op1_b15 =  oszapc.op1_16 & 0x8000;
          op2_b15 =  oszapc.op2_16 & 0x8000;
          result_b15 =  oszapc.result_16 & 0x8000;
          of = (op1_b15 == op2_b15) && (result_b15 ^ op2_b15);
          break;
        case IA32_INSTR_ADD32:
        case IA32_INSTR_ADC32:
          op1_b31 =  oszapc.op1_32 & 0x80000000;
          op2_b31 =  oszapc.op2_32 & 0x80000000;
          result_b31 =  oszapc.result_32 & 0x80000000;
          of = (op1_b31 == op2_b31) && (result_b31 ^ op2_b31);
          break;
        case IA32_INSTR_SUB8:
        case IA32_INSTR_SBB8:
          op1_b7 =  oszapc.op1_8 & 0x80;
          op2_b7 =  oszapc.op2_8 & 0x80;
          result_b7 =  oszapc.result_8 & 0x80;
          of = (op1_b7 ^ op2_b7) && (op1_b7 ^ result_b7);
          break;
        case IA32_INSTR_SUB16:
        case IA32_INSTR_SBB16:
          op1_b15 =  oszapc.op1_16 & 0x8000;
          op2_b15 =  oszapc.op2_16 & 0x8000;
          result_b15 =  oszapc.result_16 & 0x8000;
          of = (op1_b15 ^ op2_b15) && (op1_b15 ^ result_b15);
          break;
        case IA32_INSTR_SUB32:
        case IA32_INSTR_SBB32:
          op1_b31 =  oszapc.op1_32 & 0x80000000;
          op2_b31 =  oszapc.op2_32 & 0x80000000;
          result_b31 =  oszapc.result_32 & 0x80000000;
          of = (op1_b31 ^ op2_b31) && (op1_b31 ^ result_b31);
          break;
        case IA32_INSTR_NEG8:
          of = ( oszapc.result_8 == 0x80);
          break;
        case IA32_INSTR_NEG16:
          of = ( oszapc.result_16 == 0x8000);
          break;
        case IA32_INSTR_NEG32:
          of = ( oszapc.result_32 == 0x80000000);
          break;
        case IA32_INSTR_LOGIC8:
        case IA32_INSTR_LOGIC16:
        case IA32_INSTR_LOGIC32:
        case IA32_INSTR_BITSCAN16:
        case IA32_INSTR_BITSCAN32:
        case IA32_INSTR_SAR8:
        case IA32_INSTR_SAR16:
        case IA32_INSTR_SAR32:
          of = 0;
          break;
        case IA32_INSTR_SHR8:
          if ( oszapc.op2_8 == 1)
            of = ( oszapc.op1_8 >= 0x80);
          else
            of = 0; /* undocumented, but hardware really does it */
          break;
        case IA32_INSTR_SHR16:
          if ( oszapc.op2_16 == 1)
            of = ( oszapc.op1_16 >= 0x8000);
          else
            of = 0; /* undocumented, but hardware really does it */
          break;
        case IA32_INSTR_SHR32:
          if ( oszapc.op2_32 == 1)
            of = ( oszapc.op1_32 >= 0x80000000);
          else
            of = 0; /* undocumented, but hardware really does it */
          break;
        case IA32_INSTR_SHL8:
          if ( oszapc.op2_8 == 1)
            of = (( oszapc.op1_8 ^
                 oszapc.result_8) & 0x80) > 0;
          else
            of = ((( oszapc.op1_8 <<
                   ( oszapc.op2_8 - 1)) ^
                       oszapc.result_8) & 0x80) > 0;
          break;
        case IA32_INSTR_SHL16:
          if ( oszapc.op2_16 == 1)
            of = (( oszapc.op1_16 ^
                 oszapc.result_16) & 0x8000) > 0;
          else
            of = ((( oszapc.op1_16 <<
                   ( oszapc.op2_16 - 1)) ^
                       oszapc.result_16) & 0x8000) > 0;
          break;
        case IA32_INSTR_SHL32:
          if ( oszapc.op2_32 == 1)
            of = (( oszapc.op1_32 ^
                 oszapc.result_32) & 0x80000000) > 0;
          else
            of = ((( oszapc.op1_32 <<
                   ( oszapc.op2_32 - 1)) ^
                       oszapc.result_32) & 0x80000000) > 0;
          break;
        case IA32_INSTR_IMUL8:
          of = ! (( oszapc.op1_8 < 0x80 &&
                    oszapc.op2_8 == 0) ||
                (( oszapc.op1_8 & 0x80) && 
                   oszapc.op2_8 == 0xff));
          break;
        case IA32_INSTR_IMUL16:
          of = ! (( oszapc.op1_16 < 0x8000 &&
                    oszapc.op2_16 == 0) ||
                (( oszapc.op1_16 & 0x8000) && 
                   oszapc.op2_16 == 0xffff));
          break;
        case IA32_INSTR_IMUL32:
          of = ! (( oszapc.op1_32 < 0x80000000 &&
                    oszapc.op2_32 == 0) ||
                (( oszapc.op1_32 & 0x80000000) && 
                   oszapc.op2_32 == 0xffffffff));
          break;
        case IA32_INSTR_MUL8:
          of = ( oszapc.op2_8 != 0);
          break;
        case IA32_INSTR_MUL16:
          of = ( oszapc.op2_16 != 0);
          break;
        case IA32_INSTR_MUL32:
          of = ( oszapc.op2_32 != 0);
          break;
        default:
          of = 0; // Keep compiler happy.
        }
       lf_flags_status &= 0x0fffff;
       eflags.val32 &= ~(1<<11);
       eflags.val32 |= (!!of)<<11;
      return(of);
    case IA32_LF_INDEX_OSZAP:
      switch ( oszap.instr) 
	  {
        case IA32_INSTR_INC8:
          of =  oszap.result_8 == 0x80;
          break;
        case IA32_INSTR_INC16:
          of =  oszap.result_16 == 0x8000;
          break;
        case IA32_INSTR_INC32:
          of =  oszap.result_32 == 0x80000000;
          break;
        case IA32_INSTR_DEC8:
          of =  oszap.result_8 == 0x7F;
          break;
        case IA32_INSTR_DEC16:
          of =  oszap.result_16 == 0x7FFF;
          break;
        case IA32_INSTR_DEC32:
          of =  oszap.result_32 == 0x7FFFFFFF;
          break;
        default:
          of = 0; // Keep compiler happy.
        }
       lf_flags_status &= 0x0fffff;
       eflags.val32 &= ~(1<<11);
       eflags.val32 |= (!!of)<<11;
      return(of);
    default:
      return(0);
    }

}

bx_bool IA32_CPU::get_PFLazy(void)
{
  unsigned pf;

  switch ( ( lf_flags_status>>4) & 0x00000f ) 
  {
    case IA32_LF_INDEX_OSZAPC:
      switch ( oszapc.instr) 
	  {
        case IA32_INSTR_LOGIC8:
        case IA32_INSTR_ADD8:
        case IA32_INSTR_ADC8:
        case IA32_INSTR_SUB8:
        case IA32_INSTR_SBB8:
        case IA32_INSTR_NEG8:
        case IA32_INSTR_SAR8:
        case IA32_INSTR_SHR8:
        case IA32_INSTR_SHL8:
          pf = bx_parity_lookup[ oszapc.result_8];
          break;
        case IA32_INSTR_LOGIC16:
        case IA32_INSTR_ADD16:
        case IA32_INSTR_ADC16:
        case IA32_INSTR_SUB16:
        case IA32_INSTR_SBB16:
        case IA32_INSTR_NEG16:
        case IA32_INSTR_SAR16:
        case IA32_INSTR_SHR16:
        case IA32_INSTR_SHL16:
        case IA32_INSTR_BITSCAN16:
          pf = bx_parity_lookup[(Bit8u)  oszapc.result_16];
          break;
        case IA32_INSTR_LOGIC32:
        case IA32_INSTR_ADD32:
        case IA32_INSTR_ADC32:
        case IA32_INSTR_SUB32:
        case IA32_INSTR_SBB32:
        case IA32_INSTR_NEG32:
        case IA32_INSTR_SAR32:
        case IA32_INSTR_SHR32:
        case IA32_INSTR_SHL32:
        case IA32_INSTR_BITSCAN32:
          pf = bx_parity_lookup[(Bit8u)  oszapc.result_32];
          break;
        case IA32_INSTR_IMUL8:
        case IA32_INSTR_MUL8:
          pf = bx_parity_lookup[ oszapc.op1_8];
          break;
        case IA32_INSTR_IMUL16:
        case IA32_INSTR_MUL16:
          pf = bx_parity_lookup[(Bit8u)  oszapc.op1_16];
          break;
        case IA32_INSTR_IMUL32:
        case IA32_INSTR_MUL32:
          pf = bx_parity_lookup[(Bit8u)  oszapc.op1_32];
          break;
        default:
          pf = 0; // Keep compiler quiet.
        }
       lf_flags_status &= 0xffff0f;
       eflags.val32 &= ~(1<<2);
       eflags.val32 |= (pf)<<2; // pf is always 0 or 1 here
      return(pf);
    case IA32_LF_INDEX_OSZAP:
      switch ( oszap.instr) 
	  {
        case IA32_INSTR_INC8:
        case IA32_INSTR_DEC8:
          pf = bx_parity_lookup[ oszap.result_8];
          break;
        case IA32_INSTR_INC16:
        case IA32_INSTR_DEC16:
          pf = bx_parity_lookup[(Bit8u)  oszap.result_16];
          break;
        case IA32_INSTR_INC32:
        case IA32_INSTR_DEC32:
          pf = bx_parity_lookup[(Bit8u)  oszap.result_32];
          break;
        default:
          pf = 0; // Keep compiler quiet.
         }
       lf_flags_status &= 0xffff0f;
       eflags.val32 &= ~(1<<2);
       eflags.val32 |= (pf)<<2; // pf is always 0 or 1 here
      return(pf);
    default:
      return(0);
    }

}
